import 'package:dio/dio.dart';
import 'http_config.dart';
class HttpRequestData {
  static final BaseOptions baseOptions = BaseOptions(baseUrl: HttpConfig.baseUrl, sendTimeout: HttpConfig.sendTimeout);
  static final Dio dio = Dio(baseOptions);
  static Future<T> request<T>(String url, {String method = "get", Map<String, dynamic>? params}) async{
    try {
      final options = Options(method: method);
      var response = await dio.request(url, queryParameters: params, options: options);
      return response.data;
    } on DioError catch(e) {
      return Future.error(e);
    }
  }
}